Towards Constraint-based Type Inference with Polymorphic Recursion for Functional and Logic Programs

نویسندگان

  • Tom Schrijvers
  • Maurice Bruynooghe
چکیده

Type inference in the context of polymorphic recursion is notoriously difficult. The extensions to the traditional λ-calculus type inference algorithm by both Hindley-Milner and Mycroft are not capable of deriving the most general, i.e. principal types for programs with polymorphic recursion. Henglein has proposed a different algorithm, based on arrow graph reweriting, with an extended occurs check that allows for practical principal type inference in a large class of programs. We propose a new constraint-based formulation of Henglein’s inference algorithm. Our formulation of the algorithm is simple, elegant and highly declarative in nature. It relates the opertional nature of the type inference more clearly to the formal theory of the type constraints and reveals how to extend the algorithm for logic programs.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Inferring Cost Equations for Recursive, Polymorphic and Higher-Order Functional Programs

This paper presents a type-based analysis for inferring sizeand cost-equations for recursive, higher-order and polymorphic functional programs without requiring user annotations or unusual syntax. Our type reconstruction algorithm is capable of inferring cost equations for a subset of recursive programs whose costs can be expressed using primitive recursion. We illustrate the approach with refe...

متن کامل

Constraint Abstractions

Many type based program analyses with subtyping, such as ow analysis, are based on inequality constraints over a lattice. When inequality constraints are combined with polymorphism it is often hard to scale the analysis up to large programs. A major source of ineeciency in conventional implementations stems from computing substitution instances of constraints. In this paper we extend the constr...

متن کامل

Type Inference for the Mixture of Matching and Implicit Subtyping

We present a type inference system for a language with object-oriented features such as polymorphic record access and subtyping. We separate the notion of matching and subtyping in order to avoid di culties caused by recursive type constraints. We will use two kinds of type constraints | record (variant) constraints and subtyping constraints. Then, we discuss simpli cation of such mixed type co...

متن کامل

Type Systems and the Program Verification ∗

The famous slogan by Robin Milner said that ”well-typed programs do not go wrong”. This slogan essentially asserts the soundness of the type system of the programming language. This is the question whether the type system prevents us from writing meaningful and errorfree programs. The proof generation capabilities of proof construction systems based on type theory. The ground of the theory is t...

متن کامل

Types in Logic Programming

Types play an increasingly important role in logic programming, in language design as well as language implementation. We present various views of types, their connection, and their role within the logic programming paradigm. Among the basic views of types we find the so-called descriptive systems, where types describe properties of untyped logic programs, and prescriptive systems, where types ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2008